package com.baseDemo.web.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baseDemo.web.entity.SystemInfoEntity;
import com.baseDemo.web.service.systeminfo.SystemInfoService;
import com.share.hibernate.baseDaoSupport.PageUtil;

@Controller
@RequestMapping(value = "/systeminfo", produces = "application/json;charset=UTF-8")
public class SystemInfoController {
	@Resource
	private SystemInfoService systemInfoService;
	/**
	 * 分页查询所有数据
	 */
	@RequestMapping(value = "/getAllByPage")
	public @ResponseBody
	PageUtil getAllByPage(@RequestParam("page") Integer page,
			@RequestParam("limit") Integer limit,
			@RequestParam("start") Integer start) {
		return systemInfoService.getListForPageToJson(start, limit);
	}
	/**
	 * 修改
	 * @param systemInfoEntity
	 * @return
	 */
	@RequestMapping(value = "/updateSystemInfo")
	@ResponseBody
	public String updateSystemInfo(@RequestBody SystemInfoEntity systemInfoEntity){
		return systemInfoService.updateSystemInfo(systemInfoEntity);
	}
	/**
	 * 删除
	 * @param systemInfoEntity
	 * @return
	 */
	@RequestMapping(value = "/destroySystemInfo")
	@ResponseBody
	public String destroySystemInfo(@RequestBody SystemInfoEntity systemInfoEntity){
		return systemInfoService.delete(systemInfoEntity);
	}
	/**
	 * 增加
	 * @param systemInfoEntity
	 * @return
	 */
	@RequestMapping(value = "/addSystemInfo")
	@ResponseBody
	public String addSystemInfo(@RequestBody SystemInfoEntity systemInfoEntity){
		return systemInfoService.addNewSystemInfo(systemInfoEntity);
	}
}
